package org.gdstash.file;

import net.objecthunter.exp4j.Expression;
import net.objecthunter.exp4j.ExpressionBuilder;
import org.gdstash.db.*;
import org.gdstash.ui.GDStashFrame;
import org.gdstash.util.GDConstants;

import java.util.LinkedList;
import java.util.List;

public class ARZRecord {
    public int strID;
    public int len_str;
    public String str;
    public int offset;
    public int len_comp;
    public int len_decomp;
    public byte[] filedata;
    public boolean error;
    public boolean storeInDB;
    private String fileName;
    private String fileDesc;
    private String recordClass;
    private String template;
    private String factionAltNeutralTag;
    public List<DBSkillBonus> dbSkillBonuses;
    private List<DBFactionReputation> factionReputations;
    private boolean factionBountyEnabled;
    private boolean factionQuestEnabled;
    private String factionTag;
    private List<String> classTableIDs;
    private String merchantFactionID;
    private String merchantTableSetID;
    private List<String> merchantTableIDs;
    private List<String> merchantItemIDs;
    private int playerBaseDex;
    private int playerBaseInt;
    private int playerBaseStr;
    private int playerBaseLife;
    private int playerBaseMana;
    private List<DBEnginePlayerMasteries> masteries;
    private int playerIncDex;
    private int playerIncInt;
    private int playerIncStr;
    private int playerIncLife;
    private int playerIncMana;
    private List<DBEngineMasteryTier> masteryTiers;
    private int playerMaxLevel;
    private String xpFormula;
    private List<DBEngineLevel.LevelStats> levelStats;
    private int playerMaxDevotion;
    private int xOffset;
    private int xSize;
    private int yOffset;
    private String constellationNameTag;
    private String constellationInfoTag;
    private List<DBConstellationAffinity> constellationAffinities;
    private List<DBConstellationStar> constellationStars;
    private String shrineNameTag;
    private String shrineName;
    private boolean shrineNormalDisabled;
    private boolean shrineNormalLocked;
    private boolean shrineEpicDisabled;
    private boolean shrineEpicLocked;
    private boolean shrineLegendaryDisabled;
    private boolean shrineLegendaryLocked;
    private String buttonSkillID;
    private int posX;
    private int posY;
    private int offsetX;
    private int offsetY;
    private boolean circularButton;
    private String masteryBarID;
    private String skillPaneID;
    private String masteryBitmapID;
    private List<String> skillButtons;
    private String titleTag;
    private List<DBSkillTreeAlloc> masterySkillIDs;
    private String skillBuffID;
    private String skillDescription;
    private String skillNameTag;
    private String skillName;
    private boolean mastery;
    private boolean devotion;
    private int skillTier;
    private int maxLevel;
    private String bitmapDownID;
    private String bitmapUpID;
    private int skillLevel;
    private int skillDuration;
    private boolean bonusIncrement;
    private boolean skillModified;
    private boolean skillDependencyAll;
    private List<Integer> skillXPLevels;
    private List<DBSkillDependency> skillDependencies;
    private List<DBSkillConnector> skillConnections;
    private int triggerChance;
    private String triggerType;
    private int lootRandomCost;
    private String lootRandomName;
    private String convertIn;
    private String convertOut;
    private String convertIn2;
    private String convertOut2;
    private String petBonusID;
    private String rarity;
    private int reqLevel;
    private String itemSkillID;
    private String itemSkillLevelFormula;
    private int itemSkillLevel;
    private int offensiveChance;
    private int retaliationChance;
    private int rngPercent;
    private String skillControllerID;
    private List<DBSkillModifier> skillModifiers;
    private List<DBAffixSet.DBEntry> randomizers;
    private String itemSetDescTag;
    private int skillModifierLevel;
    private List<String> itemSetItemIDs;
    private String itemSetNameTag;
    private boolean nPre_nSuf;
    private boolean nPre_rSuf;
    private boolean rPre_nSuf;
    private boolean rPre_rSuf;
    private List<DBLootTableItemAlloc> tableItems;
    private List<DBLootTableAffixSetAlloc> tableAffixSets;
    private List<DBLootTableSetAlloc> tableSetAllocs;
    private List<DBFormula> formulaSetFormulas;
    private String armorClass;
    private String artifactClass;
    private String artifactID;
    private String meshID;
    private String baseTextureID;
    private String bumpTextureID;
    private String glowTextureID;
    private String shaderID;
    private String bitmapID;
    private String shardBitmapID;
    private String itemNameTag;
    private String itemDescriptionTag;
    private int genderCode;
    private String itemName;
    private String itemDescription;
    private String qualityTag;
    private String styleTag;
    private String itemSetID;
    private String bonusAffixSetID;
    private String costFormulaSetID;
    private boolean soulbound;
    private boolean hidePrefix;
    private boolean hideSuffix;
    private boolean questItem;
    private boolean cannotPickup;
    private int itemLevel;
    private int plusAllSkills;
    private int componentPieces;
    private int maxStackSize;
    private ItemSlots slots;
    private String petName;
    private String petFormulaLevel;
    private String petBioID;
    private String petDieSkillID;
    private List<DBPetSkill> petSkills;
    private String bioFormulaLife;
    private String bioFormulaMana;
    private List<DBStat> dbStats;
    private List<DBStatBonusRace> dbStatBonusRaces;
    private List<DBSkillSpawn> dbSpawnPets;
    private int ySize;
    private DBFormulaSet dbFormulaSet;
    private String dlcRequirement;

    public ARZRecord() {
        this.error = false;
        this.storeInDB = false;
        this.slots = new ItemSlots();
        this.factionReputations = new LinkedList<DBFactionReputation>();
        this.masteryTiers = new LinkedList<DBEngineMasteryTier>();
        this.classTableIDs = new LinkedList<String>();
        this.skillModifiers = new LinkedList<DBSkillModifier>();
        this.randomizers = new LinkedList<DBAffixSet.DBEntry>();
        this.itemSetItemIDs = new LinkedList<String>();
        this.tableItems = new LinkedList<DBLootTableItemAlloc>();
        this.tableAffixSets = new LinkedList<DBLootTableAffixSetAlloc>();
        this.tableSetAllocs = new LinkedList<DBLootTableSetAlloc>();
        this.formulaSetFormulas = new LinkedList<DBFormula>();
        this.dbFormulaSet = null;
        this.dbStatBonusRaces = new LinkedList<DBStatBonusRace>();
        this.dbSpawnPets = new LinkedList<DBSkillSpawn>();
        this.dbStats = new LinkedList<DBStat>();
        this.dbSkillBonuses = new LinkedList<DBSkillBonus>();
        this.merchantTableIDs = new LinkedList<String>();
        this.merchantItemIDs = new LinkedList<String>();
        this.masteries = new LinkedList<DBEnginePlayerMasteries>();
        this.levelStats = new LinkedList<DBEngineLevel.LevelStats>();
        this.constellationAffinities = new LinkedList<DBConstellationAffinity>();
        this.constellationStars = new LinkedList<DBConstellationStar>();
        this.masterySkillIDs = new LinkedList<DBSkillTreeAlloc>();
        this.skillButtons = new LinkedList<String>();
        this.skillXPLevels = new LinkedList<Integer>();
        this.skillDependencies = new LinkedList<DBSkillDependency>();
        this.skillConnections = new LinkedList<DBSkillConnector>();
        this.devotion = false;
        this.petSkills = new LinkedList<DBPetSkill>();
    }

    public String getFileDescription() {
        return this.fileDesc;
    }

    public String getFileName() {
        return this.fileName;
    }

    public String getRecordClass() {
        return this.recordClass;
    }

    public String getTemplate() {
        return this.template;
    }

    public String getDLCRequirement() {
        return this.dlcRequirement;
    }

    public DBFormulaSet getDBFormulaSet() {
        if (this.dbFormulaSet == null) {
            this.dbFormulaSet = new DBFormulaSet(this);
        }
        return this.dbFormulaSet;
    }

    public List<DBStat> getDBStatList() {
        return this.dbStats;
    }

    public List<DBStatBonusRace> getDBStatBonusRaceList() {
        return this.dbStatBonusRaces;
    }

    public List<DBFactionReputation> getFactionReputationList() {
        return this.factionReputations;
    }

    public List<DBEngineMasteryTier> getMasteryTierList() {
        return this.masteryTiers;
    }

    public String getFactionAltNeutralTag() {
        return this.factionAltNeutralTag;
    }

    public boolean getFactionBountyEnabled() {
        return this.factionBountyEnabled;
    }

    public boolean getFactionQuestEnabled() {
        return this.factionQuestEnabled;
    }

    public String getFactionTag() {
        return this.factionTag;
    }

    public List<String> getSkillMasterList() {
        return this.classTableIDs;
    }

    public String getMerchantFactionID() {
        return this.merchantFactionID;
    }

    public String getMerchantTableSetID() {
        return this.merchantTableSetID;
    }

    public List<String> getMerchantTableIDList() {
        return this.merchantTableIDs;
    }

    public List<String> getMerchantTableItemIDList() {
        return this.merchantItemIDs;
    }

    public int getPlayerBaseDex() {
        return this.playerBaseDex;
    }

    public int getPlayerBaseInt() {
        return this.playerBaseInt;
    }

    public int getPlayerBaseStr() {
        return this.playerBaseStr;
    }

    public int getPlayerBaseLife() {
        return this.playerBaseLife;
    }

    public int getPlayerBaseMana() {
        return this.playerBaseMana;
    }

    public List<DBEnginePlayerMasteries> getMasteryList() {
        return this.masteries;
    }

    public int getPlayerIncDex() {
        return this.playerIncDex;
    }

    public int getPlayerIncInt() {
        return this.playerIncInt;
    }

    public int getPlayerIncStr() {
        return this.playerIncStr;
    }

    public int getPlayerIncLife() {
        return this.playerIncLife;
    }

    public int getPlayerIncMana() {
        return this.playerIncMana;
    }

    public static boolean processDir(final String dir) {
        return !dir.startsWith("records/controllers/itemskills/basetemplates/") && !dir.startsWith("records/default/") && !dir.startsWith("records/fx/") && !dir.startsWith("records/game/old/") && !dir.startsWith("records/game/reqformula031116/") && !dir.startsWith("records/ingameui/") && !dir.startsWith("records/items/lootchests/") && !dir.startsWith("records/items/testitems/") && !dir.startsWith("records/items/crafting/crafting_") && !dir.startsWith("records/level art/") && !dir.startsWith("records/proxies/") && !dir.startsWith("records/sandbox/") && !dir.startsWith("records/soundgenerators/") && !dir.startsWith("records/sounds/") && !dir.startsWith("records/terraintextures/") && !dir.startsWith("records/triggervolumes/") && !dir.startsWith("records/watertype/") && !dir.startsWith("records/items/gearweapons/staff/crafting/") && !dir.startsWith("records/items/gearweapons/spears/crafting/%") && !dir.startsWith("records/items/crafting/blueprints/weapon/crafting_") && (dir.startsWith("records/creatures/pc/malepc01.dbr") || dir.startsWith("records/creatures/pc/playerlevels.dbr") || dir.startsWith("records/creatures/npcs/merchants/") || dir.startsWith("records/creatures/npcs/npcgear/") || (!dir.startsWith("records/creatures/") && (dir.startsWith("records/ui/") || !dir.startsWith("records/ui load tables/"))));
    }

    public int getPlayerMaxLevel() {
        return this.playerMaxLevel;
    }

    public String getXPFormula() {
        return this.xpFormula;
    }

    public List<DBEngineLevel.LevelStats> getLevelStatList() {
        return this.levelStats;
    }

    public static boolean processTemplate(final String template, final boolean extractItems) {
        if (template.equals("database/templates/armor_chest.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/armor_feet.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/armor_hands.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/armor_head.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/armor_legs.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/armor_shoulders.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_axe.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_mace.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_dagger.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_scepter.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_spear.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_staff.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_sword.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_ranged1h.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_ranged2h.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_axe2h.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_mace2h.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_spear2h.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_sword2h.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weapon_offhand.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/weaponarmor_shield.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/jewelry_amulet.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/jewelry_medal.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/jewelry_ring.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/armor_waist.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemusableskill.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemtransmuter.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemtransmuterset.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemartifactformula.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/questitem.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/oneshot_scroll.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/oneshot_endlessdungeon.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/oneshot_potion.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemenchantment.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemrelic.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemartifact.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemnote.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemfactionbooster.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemfactionwarrant.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemdifficultyunlock.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/oneshot_food.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/oneshot_potionmana.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/oneshot_potionhealth.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemdevotionreset.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemattributereset.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/oneshot_sack.tpl")) {
            return extractItems;
        }
        if (template.equals("database/templates/itemset.tpl")) {
            return extractItems;
        }
        return template.equals("database/templates/lootrandomizer.tpl") || template.equals("database/templates/lootrandomizertabledynamic.tpl") || template.equals("database/templates/leveltable.tpl") || template.equals("database/templates/lootitemtable_dynweighted_dynaffix.tpl") || template.equals("database/templates/skilltree.tpl") || template.equals("database/templates/skilltree_expanded.tpl") || template.equals("database/templates/skilltree_100.tpl") || template.startsWith("database/templates/skill") || template.equals("database/templates/petbonus.tpl") || template.equals("database/templates/fixeditemskill_buff.tpl") || template.equals("database/templates/skillautocastcontroller.tpl") || template.equals("database/templates/pet.tpl") || template.equals("database/templates/petplayerscaling.tpl") || template.equals("database/templates/characterattributeequations.tpl") || template.equals("database/templates/staticshrine.tpl") || template.equals("database/templates/factionpack.tpl") || template.equals("database/templates/npcmerchant.tpl") || template.equals("database/templates/factionmarket.tpl") || template.equals("database/templates/factiontier.tpl") || template.equals("database/templates/gameengine.tpl") || template.equals("database/templates/gamefactions.tpl") || template.equals("database/templates/itemcost.tpl") || template.equals("database/templates/player.tpl") || template.equals("database/templates/experiencelevelcontrol.tpl") || template.equals("database/templates/ingameui/devotionconstellation.tpl") || template.equals("database/templates/ingameui/skillbutton.tpl") || template.equals("database/templates/ingameui/bitmapsingle.tpl") || template.equals("database/templates/ingameui/inventorygrid.tpl") || template.equals("database/templates/ingameui/caravanwindowprivate.tpl") || template.equals("database/templates/ingameui/caravanwindowpublic.tpl") || template.equals("database/templates/ingameui/bargraph.tpl") || template.equals("database/templates/ingameui/skillpanectrl.tpl") || template.equals("database/templates/ingameui/skillswindow.tpl");
    }

    public static boolean processFile(final String filename, final String template) {
        if (template.equals("database/templates/gameengine.tpl")) {
            return filename.equals("records/game/gameengine.dbr");
        }
        return !filename.equals("records/items/loottables/weapons/tdyn_gun2hcrossbow_c01.dbr") && !filename.equals("records/items/loottables/weapons/tdyn_gun2hcrossbow_c01b.dbr") && !filename.equals("records/items/loottables/weapons/tdyn_gun2hcrossbow_d01.dbr") && !filename.endsWith("_blank.dbr") && !filename.contains("/old/");
    }

    public int getPlayerMaxDevotion() {
        return this.playerMaxDevotion;
    }

    public void setPlayerMaxDevotion(final int playerMaxDevotion) {
        this.playerMaxDevotion = playerMaxDevotion;
    }

    public String getConstellationNameTag() {
        return this.constellationNameTag;
    }

    public String getConstellationInfoTag() {
        return this.constellationInfoTag;
    }

    public List<DBConstellationAffinity> getConstellationAffinityList() {
        return this.constellationAffinities;
    }

    public List<DBConstellationStar> getConstellationStarList() {
        return this.constellationStars;
    }

    public String getShrineName() {
        return this.shrineName;
    }

    public boolean getShrineNormalDisabled() {
        return this.shrineNormalDisabled;
    }

    public boolean getShrineNormalLocked() {
        return this.shrineNormalLocked;
    }

    public boolean getShrineEpicDisabled() {
        return this.shrineEpicDisabled;
    }

    public boolean getShrineEpicLocked() {
        return this.shrineEpicLocked;
    }

    public boolean getShrineLegendaryDisabled() {
        return this.shrineLegendaryDisabled;
    }

    public boolean getShrineLegendaryLocked() {
        return this.shrineLegendaryLocked;
    }

    public String getButtonSkillID() {
        return this.buttonSkillID;
    }

    public int getPosX() {
        return this.posX;
    }

    public int getPosY() {
        return this.posY;
    }

    public int getOffsetX() {
        return this.offsetX;
    }

    public int getOffsetY() {
        return this.offsetY;
    }

    public boolean getCircularButton() {
        return this.circularButton;
    }

    public String getMasteryBarID() {
        return this.masteryBarID;
    }

    public String getSkillPaneID() {
        return this.skillPaneID;
    }

    public String getMasteryBitmapID() {
        return this.masteryBitmapID;
    }

    public List<String> getSkillButtonList() {
        return this.skillButtons;
    }

    public String getTitleTag() {
        return this.titleTag;
    }

    public List<DBSkillTreeAlloc> getMasterySkillList() {
        return this.masterySkillIDs;
    }

    public String getSkillBuffID() {
        return this.skillBuffID;
    }

    public String getSkillDescription() {
        return this.skillDescription;
    }

    public String getSkillNameTag() {
        return this.skillNameTag;
    }

    public String getSkillName() {
        return this.skillName;
    }

    public boolean isMastery() {
        return this.mastery;
    }

    public boolean isDevotion() {
        return this.devotion;
    }

    public int getSkillTier() {
        return this.skillTier;
    }

    public int getSkillMaxLevel() {
        return this.maxLevel;
    }

    public String getSkillBitmapDownID() {
        return this.bitmapDownID;
    }

    public String getSkillBitmapUpID() {
        return this.bitmapUpID;
    }

    public int getSkillLevel() {
        return this.skillLevel;
    }

    public int getSkillDuration() {
        return this.skillDuration;
    }

    public boolean hasSkillBonusIncrement() {
        return this.bonusIncrement;
    }

    public boolean hasSkillModifier() {
        return this.skillModified;
    }

    public boolean isDependencyAll() {
        return this.skillDependencyAll;
    }

    public List<DBSkillSpawn> getSpawnPetList() {
        return this.dbSpawnPets;
    }

    public List<Integer> getSkillXPLevelList() {
        return this.skillXPLevels;
    }

    public List<DBSkillDependency> getSkillDependencyList() {
        return this.skillDependencies;
    }

    public List<DBSkillConnector> getSkillConnectorList() {
        return this.skillConnections;
    }

    public int getTriggerChance() {
        return this.triggerChance;
    }

    public String getTriggerType() {
        return this.triggerType;
    }

    public int getLootRandomCost() {
        return this.lootRandomCost;
    }

    public String getLootRandomName() {
        return this.lootRandomName;
    }

    public String getConversionIn() {
        return this.convertIn;
    }

    public String getConversionOut() {
        return this.convertOut;
    }

    public String getConversionIn2() {
        return this.convertIn2;
    }

    public String getConversionOut2() {
        return this.convertOut2;
    }

    public String getItemSkillID() {
        return this.itemSkillID;
    }

    public String getItemSkillLevelFormula() {
        return this.itemSkillLevelFormula;
    }

    public int getItemSkillLevel() {
        return this.itemSkillLevel;
    }

    public int getOffensiveChance() {
        return this.offensiveChance;
    }

    public String getPetBonusID() {
        return this.petBonusID;
    }

    public String getRarity() {
        return this.rarity;
    }

    public int getRequiredLevel() {
        return this.reqLevel;
    }

    public int getRetaliationChance() {
        return this.retaliationChance;
    }

    public int getRNGPercent() {
        return this.rngPercent;
    }

    public String getSkillControllerID() {
        return this.skillControllerID;
    }

    public List<DBAffixSet.DBEntry> getAffixSetRandomizerList() {
        return this.randomizers;
    }

    public List<String> getItemSetItemIDList() {
        return this.itemSetItemIDs;
    }

    public String getItemSetDescriptionTag() {
        return this.itemSetDescTag;
    }

    public int getItemSetSkillModifierLevel() {
        return this.skillModifierLevel;
    }

    public String getItemSetNameTag() {
        return this.itemSetNameTag;
    }

    public boolean getTableNormalPrefixSuffix() {
        return this.nPre_nSuf;
    }

    public boolean getTableNormalPrefixRareSuffix() {
        return this.nPre_rSuf;
    }

    public boolean getTableRarePrefixNormalSuffix() {
        return this.rPre_nSuf;
    }

    public boolean getTableRarePrefixSuffix() {
        return this.rPre_rSuf;
    }

    public List<DBLootTableItemAlloc> getTableItemAllocList() {
        return this.tableItems;
    }

    public List<DBLootTableAffixSetAlloc> getTableAffixSetAllocList() {
        return this.tableAffixSets;
    }

    public List<DBLootTableSetAlloc> getTableSetAllocList() {
        return this.tableSetAllocs;
    }

    public List<DBFormula> getFormulaSetFormulaList() {
        return this.formulaSetFormulas;
    }

    public String getArmorClass() {
        return this.armorClass;
    }

    public String getArtifactClass() {
        return this.artifactClass;
    }

    public String getMeshID() {
        return this.meshID;
    }

    public String getBaseTextureID() {
        return this.baseTextureID;
    }

    public String getBumpTextureID() {
        return this.bumpTextureID;
    }

    public String getGlowTextureID() {
        return this.glowTextureID;
    }

    public String getShaderID() {
        return this.shaderID;
    }

    public String getBitmapID() {
        return this.bitmapID;
    }

    public String getShardBitmapID() {
        return this.shardBitmapID;
    }

    public String getItemNameTag() {
        return this.itemNameTag;
    }

    public int getGenderCode() {
        return this.genderCode;
    }

    public String getItemDescription() {
        return this.itemDescription;
    }

    public String getItemName() {
        return this.itemName;
    }

    public String getQualityTag() {
        return this.qualityTag;
    }

    public String getStyleTag() {
        return this.styleTag;
    }

    public String getItemSetID() {
        return this.itemSetID;
    }

    public String getArtifactID() {
        return this.artifactID;
    }

    public String getBonusAffixSetID() {
        return this.bonusAffixSetID;
    }

    public String getCostFormulaSetID() {
        return this.costFormulaSetID;
    }

    public boolean isSoulbound() {
        return this.soulbound;
    }

    public boolean isHidePrefix() {
        return this.hidePrefix;
    }

    public boolean isHideSuffix() {
        return this.hideSuffix;
    }

    public boolean isQuestItem() {
        return this.questItem;
    }

    public boolean isCannotPickup() {
        return this.cannotPickup;
    }

    public int getItemLevel() {
        return this.itemLevel;
    }

    public int getPlusAllSkills() {
        return this.plusAllSkills;
    }

    public int getComponentPieces() {
        return this.componentPieces;
    }

    public int getMaxStackSize() {
        return this.maxStackSize;
    }

    public List<DBSkillModifier> getSkillModifierList() {
        return this.skillModifiers;
    }

    public void addModifierSkillID(final int index, final String skillID) {
        boolean found = false;
        for (final DBSkillModifier modifier : this.skillModifiers) {
            if (modifier.getIndex() == index) {
                modifier.setSkillID(skillID);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBSkillModifier modifier2 = new DBSkillModifier();
            modifier2.setIndex(index);
            modifier2.setSkillID(skillID);
            this.skillModifiers.add(modifier2);
        }
    }

    public void addModifierModifierID(final int index, final String modifierID) {
        boolean found = false;
        for (final DBSkillModifier modifier : this.skillModifiers) {
            if (modifier.getIndex() == index) {
                modifier.setModifierID(modifierID);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBSkillModifier modifier2 = new DBSkillModifier();
            modifier2.setIndex(index);
            modifier2.setModifierID(modifierID);
            this.skillModifiers.add(modifier2);
        }
    }

    public ItemSlots getItemSlots() {
        return this.slots;
    }

    public String getPetFormulaLevel() {
        return this.petFormulaLevel;
    }

    public String getPetBioID() {
        return this.petBioID;
    }

    public String getPetDieSkillID() {
        return this.petDieSkillID;
    }

    public List<DBPetSkill> getPetSkillList() {
        return this.petSkills;
    }

    public String getPetName() {
        return this.petName;
    }

    public String getBioFormulaLife() {
        return this.bioFormulaLife;
    }

    public String getBioFormulaMana() {
        return this.bioFormulaMana;
    }

    public int getXOffset() {
        return this.xOffset;
    }

    public void setXOffset(final int xOffset) {
        this.xOffset = xOffset;
    }

    public int getXSize() {
        return this.xSize;
    }

    public void setXSize(final int xSize) {
        this.xSize = xSize;
    }

    public int getYOffset() {
        return this.yOffset;
    }

    public void setYOffset(final int yOffset) {
        this.yOffset = yOffset;
    }

    public void addFactionReputationStateTag(final int index, final String stateTag) {
        boolean found = false;
        for (final DBFactionReputation reputation : this.factionReputations) {
            if (reputation.getIndex() == index) {
                reputation.setStateTag(stateTag);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBFactionReputation reputation2 = new DBFactionReputation();
            reputation2.setIndex(index);
            reputation2.setStateTag(stateTag);
            this.factionReputations.add(reputation2);
        }
    }

    public void addFactionReputationValue(final int index, final int value) {
        boolean found = false;
        for (final DBFactionReputation reputation : this.factionReputations) {
            if (reputation.getIndex() == index) {
                reputation.setValue(value);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBFactionReputation reputation2 = new DBFactionReputation();
            reputation2.setIndex(index);
            reputation2.setValue(value);
            this.factionReputations.add(reputation2);
        }
    }

    public void addMasteryTier(final int index, final int value) {
        final DBEngineMasteryTier mt = new DBEngineMasteryTier(index, value);
        this.masteryTiers.add(mt);
    }

    public int getYSize() {
        return this.ySize;
    }

    public void setYSize(final int ySize) {
        this.ySize = ySize;
    }

    public void setFileDescription(final String filedesc) {
        this.fileDesc = filedesc;
    }

    public void setFileName(final String fileName) {
        this.fileName = fileName;
    }

    public void addSkillMaster(final String classTableID) {
        this.classTableIDs.add(classTableID);
    }

    public void setRecordClass(final String recordClass) {
        this.recordClass = recordClass;
    }

    public void setTemplate(final String template) {
        this.template = template;
        if (template != null) {
            this.mastery = template.equals("database/templates/skill_mastery.tpl");
        }
    }

    public void addMerchantTableSetTableID(final String tableID) {
        this.merchantTableIDs.add(tableID);
    }

    public void addMerchantTableItemID(final String itemID) {
        this.merchantItemIDs.add(itemID);
    }

    public void setDLCRequirement(String dlcRequirement) {
        dlcRequirement = this.dlcRequirement;
    }

    public void setDBFormulaSet(final DBFormulaSet dbFormulaSet) {
        this.dbFormulaSet = dbFormulaSet;
    }

    public void setFactionAltNeutralTag(final String factionAltNeutralTag) {
        this.factionAltNeutralTag = factionAltNeutralTag;
    }

    public void setFactionBountyEnabled(final boolean factionBountyEnabled) {
        this.factionBountyEnabled = factionBountyEnabled;
    }

    public void setFactionQuestEnabled(final boolean factionQuestEnabled) {
        this.factionQuestEnabled = factionQuestEnabled;
    }

    public void addMastery(final String tag, final String masteryID) {
        final String s = tag.substring("skillTree".length());
        int index = 0;
        try {
            index = Integer.parseInt(s);
        } catch (NumberFormatException ex) {
            return;
        }
        if (!DBEnginePlayerMasteries.containsSkillTreeID(this.masteries, masteryID)) {
            this.masteries.add(new DBEnginePlayerMasteries(masteryID, index));
        }
    }

    public void setFactionTag(final String factionTag) {
        this.factionTag = factionTag;
    }

    public void setMerchantFactionID(final String merchantFactionID) {
        this.merchantFactionID = merchantFactionID;
    }

    public void setMerchantTableSetID(final String merchantTableSetID) {
        this.merchantTableSetID = merchantTableSetID;
    }

    public void setPlayerBaseDex(final int playerBaseDex) {
        this.playerBaseDex = playerBaseDex;
    }

    public void setPlayerBaseInt(final int playerBaseInt) {
        this.playerBaseInt = playerBaseInt;
    }

    public void setPlayerBaseStr(final int playerBaseStr) {
        this.playerBaseStr = playerBaseStr;
    }

    public void setPlayerBaseLife(final int playerBaseLife) {
        this.playerBaseLife = playerBaseLife;
    }

    public void setPlayerBaseMana(final int playerBaseMana) {
        this.playerBaseMana = playerBaseMana;
    }

    public void addLevelStatPoints(final int points, final int index) {
        DBEngineLevel.LevelStats stats = null;
        int skillPoints = 0;
        for (final DBEngineLevel.LevelStats ls : this.levelStats) {
            final int p = ls.getSkillPoints();
            if (p != 0) {
                skillPoints = p;
            }
            if (stats.getLevel() == index) {
                stats = ls;
                break;
            }
        }
        boolean statExists = false;
        statExists = (stats != null && stats.getLevel() == index);
        if (statExists) {
            stats.setStatPoints(points);
        } else {
            stats = new DBEngineLevel.LevelStats();
            stats.setLevel(index);
            stats.setStatPoints(points);
            stats.setSkillPoints(skillPoints);
            this.levelStats.add(stats);
        }
    }

    public void addLevelSkillPoints(final int points, final int index) {
        DBEngineLevel.LevelStats stats = null;
        int statPoints = 0;
        for (final DBEngineLevel.LevelStats ls : this.levelStats) {
            final int p = ls.getStatPoints();
            if (p != 0) {
                statPoints = p;
            }
            if (ls.getLevel() == index) {
                stats = ls;
                break;
            }
        }
        boolean statExists = false;
        statExists = (stats != null && stats.getLevel() == index);
        if (statExists) {
            stats.setSkillPoints(points);
        } else {
            stats = new DBEngineLevel.LevelStats();
            stats.setLevel(index);
            stats.setStatPoints(statPoints);
            stats.setSkillPoints(points);
            this.levelStats.add(stats);
        }
    }

    public void setPlayerIncDex(final int playerIncDex) {
        this.playerIncDex = playerIncDex;
    }

    public void setPlayerIncInt(final int playerIncInt) {
        this.playerIncInt = playerIncInt;
    }

    public void setPlayerIncStr(final int playerIncStr) {
        this.playerIncStr = playerIncStr;
    }

    public void setPlayerIncLife(final int playerIncLife) {
        this.playerIncLife = playerIncLife;
    }

    public void setPlayerIncMana(final int playerIncMana) {
        this.playerIncMana = playerIncMana;
    }

    public void getConstellationInfoTag(final String constellationInfoTag) {
        this.constellationInfoTag = constellationInfoTag;
    }

    public void addConstellationAffinityName(final String tag, final String name) {
        boolean found = false;
        final boolean required = tag.startsWith("affinityRequired");
        int index = 0;
        String s = null;
        if (required) {
            s = tag.substring("affinityRequiredName".length());
        } else {
            s = tag.substring("affinityGivenName".length());
        }
        try {
            index = Integer.parseInt(s);
        } catch (NumberFormatException ex) {
            return;
        }
        for (final DBConstellationAffinity dbAffinity : this.constellationAffinities) {
            if (dbAffinity.getIndex() == index && dbAffinity.isRequired() == required) {
                dbAffinity.setAffinity(name);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBConstellationAffinity dbAffinity2 = new DBConstellationAffinity();
            dbAffinity2.setIndex(index);
            dbAffinity2.setRequired(required);
            dbAffinity2.setAffinity(name);
            this.constellationAffinities.add(dbAffinity2);
        }
    }

    public void addConstellationAffinityPoints(final String tag, final int points) {
        boolean found = false;
        final boolean required = tag.startsWith("affinityRequired");
        int index = 0;
        String s = null;
        if (required) {
            s = tag.substring("affinityRequired".length());
        } else {
            s = tag.substring("affinityGiven".length());
        }
        try {
            index = Integer.parseInt(s);
        } catch (NumberFormatException ex) {
            return;
        }
        for (final DBConstellationAffinity dbAffinity : this.constellationAffinities) {
            if (dbAffinity.getIndex() == index && dbAffinity.isRequired() == required) {
                dbAffinity.setPoints(points);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBConstellationAffinity dbAffinity2 = new DBConstellationAffinity();
            dbAffinity2.setIndex(index);
            dbAffinity2.setRequired(required);
            dbAffinity2.setPoints(points);
            this.constellationAffinities.add(dbAffinity2);
        }
    }

    public void addConstellationStar(final String tag, final String skillID) {
        int index = 0;
        String s = null;
        s = tag.substring("devotionButton".length());
        try {
            index = Integer.parseInt(s);
        } catch (NumberFormatException ex) {
            return;
        }
        final DBConstellationStar dbStar = new DBConstellationStar();
        dbStar.setIndex(index);
        dbStar.setButtonID(skillID);
        this.constellationStars.add(dbStar);
    }

    public void setPlayerMaxLevel(final int playerMaxLevel) {
        this.playerMaxLevel = playerMaxLevel;
    }

    public void setXPFormula(final String xpFormula) {
        this.xpFormula = xpFormula;
    }

    public void setConstellationNameTag(final String constellationNameTag) {
        this.constellationNameTag = constellationNameTag;
    }

    public void setShrineName(final String shrineNameTag) {
        this.shrineName = GDStashFrame.arcList.getTag(ARCDecompress.FileModule.All, GDConstants.TAG_TEXT_SHRINES, shrineNameTag, false);
    }

    public void setShrineNormalDisabled(final boolean shrineNormalDisabled) {
        this.shrineNormalDisabled = shrineNormalDisabled;
    }

    public void setShrineNormalLocked(final boolean shrineNormalLocked) {
        this.shrineNormalLocked = shrineNormalLocked;
    }

    public void setShrineEpicDisabled(final boolean shrineEpicDisabled) {
        this.shrineEpicDisabled = shrineEpicDisabled;
    }

    public void setShrineEpicLocked(final boolean shrineEpicLocked) {
        this.shrineEpicLocked = shrineEpicLocked;
    }

    public void setShrineLegendaryDisabled(final boolean shrineLegendaryDisabled) {
        this.shrineLegendaryDisabled = shrineLegendaryDisabled;
    }

    public void setShrineLegendaryLocked(final boolean shrineLegendaryLocked) {
        this.shrineLegendaryLocked = shrineLegendaryLocked;
    }

    public void setButtonSkillID(final String buttonSkillID) {
        this.buttonSkillID = buttonSkillID;
    }

    public void setPosX(final int posX) {
        this.posX = posX;
    }

    public void setPosY(final int posY) {
        this.posY = posY;
    }

    public void setOffsetX(final int offsetX) {
        this.offsetX = offsetX;
    }

    public void setOffsetY(final int offsetY) {
        this.offsetY = offsetY;
    }

    public void setCircularButton(final boolean circularButton) {
        this.circularButton = circularButton;
    }

    public void addSkillButton(final String skillButton) {
        this.skillButtons.add(skillButton);
    }

    public void setMasteryBarID(final String masteryBarID) {
        this.masteryBarID = masteryBarID;
    }

    public void addMasterySkill(final String skillID, final int index) {
        final DBSkillTreeAlloc alloc = new DBSkillTreeAlloc(skillID, index);
        this.masterySkillIDs.add(alloc);
    }

    public void setSkillPaneID(final String skillPaneID) {
        this.skillPaneID = skillPaneID;
    }

    public void setMasteryBitmapID(final String masteryBitmapID) {
        this.masteryBitmapID = masteryBitmapID;
    }

    public void setTitleTag(final String titleTag) {
        this.titleTag = titleTag;
    }

    public void setSkillBuffID(final String skillBuffID) {
        this.skillBuffID = skillBuffID;
    }

    public void setSkillDescription(final String skillBaseDescription) {
        this.skillDescription = GDStashFrame.arcList.getTag(ARCDecompress.FileModule.All, GDConstants.TAG_TEXT_SKILLS, skillBaseDescription, true);
    }

    public void setDevotion(final boolean devotion) {
        this.devotion = devotion;
    }

    public void setSkillTier(final int skillTier) {
        this.skillTier = skillTier;
    }

    public void setSkillMaxLevel(final int maxLevel) {
        this.maxLevel = maxLevel;
    }

    public void setSkillBitmapDownID(final String bitmapDownID) {
        this.bitmapDownID = bitmapDownID;
    }

    public void setSkillBonusIncrement(final boolean bonusIncrement) {
        this.bonusIncrement = bonusIncrement;
    }

    public void setSkillModified(final boolean skillModified) {
        this.skillModified = skillModified;
    }

    public void setSkillBitmapUpID(final String bitmapUpID) {
        this.bitmapUpID = bitmapUpID;
    }

    public void addSpawnPet(final int index, final String petID) {
        final DBSkillSpawn pet = new DBSkillSpawn(index, petID);
        this.dbSpawnPets.add(pet);
    }

    public void addSkillXPLevel(final String xp) {
        try {
            final Integer i = Integer.valueOf(xp);
            this.skillXPLevels.add(i);
            if (i > 0) {
                this.devotion = true;
            }
        } catch (NumberFormatException ex) {
        }
    }

    public void addSkillConnectionOff(final String connector, final int index) {
        boolean found = false;
        for (final DBSkillConnector connection : this.skillConnections) {
            if (connection.getIndex() == index) {
                found = true;
                connection.setConnectionOffID(connector);
                break;
            }
        }
        if (!found) {
            final DBSkillConnector connection2 = new DBSkillConnector(index, connector, null);
            this.skillConnections.add(connection2);
        }
    }

    public void addSkillConnectionOn(final String connector, final int index) {
        boolean found = false;
        for (final DBSkillConnector connection : this.skillConnections) {
            if (connection.getIndex() == index) {
                found = true;
                connection.setConnectionOnID(connector);
                break;
            }
        }
        if (!found) {
            final DBSkillConnector connection2 = new DBSkillConnector(index, null, connector);
            this.skillConnections.add(connection2);
        }
    }

    public void addSkillDependency(final String skillDep) {
        final DBSkillDependency dep = new DBSkillDependency(null, skillDep);
        this.skillDependencies.add(dep);
    }

    public void setSkillLevel(final int skillLevel) {
        this.skillLevel = skillLevel;
    }

    public void setSkillDuration(final int skillDuration) {
        this.skillDuration = skillDuration;
    }

    public void setDependencyAll(final boolean skillDependencyAll) {
        this.skillDependencyAll = skillDependencyAll;
    }

    public void setSkillNameTag(final String skillNameTag) {
        this.skillNameTag = skillNameTag;
        if (skillNameTag != null) {
            this.skillName = GDStashFrame.arcList.getTag(ARCDecompress.FileModule.All, GDConstants.TAG_TEXT_SKILLS, skillNameTag, false);
        }
    }

    public void setTriggerChance(final int triggerChance) {
        this.triggerChance = triggerChance;
    }

    public void setTriggerType(final String triggerType) {
        this.triggerType = triggerType;
    }

    public void setLootRandomCost(final int lootRandomCost) {
        this.lootRandomCost = lootRandomCost;
    }

    public void setLootRandomName(final String lootRandomName) {
        this.lootRandomName = lootRandomName;
    }

    public void setConversionIn(final String convertIn) {
        if (convertIn == null) {
            return;
        }
        if (convertIn.equals("Physical;Pierce;Elemental;Cold;Fire;Poison;Lightning;Life;Chaos;Aether;Stun")) {
            return;
        }
        this.convertIn = convertIn;
    }

    public void addRace(final String tag, final String name) {
        boolean found = false;
        for (final DBStatBonusRace race : this.dbStatBonusRaces) {
            if (race.getRaceTag().equals(tag)) {
                found = true;
                break;
            }
        }
        if (!found) {
            final DBStatBonusRace race2 = new DBStatBonusRace();
            race2.setID(this.fileName);
            race2.setRaceTag(tag);
            race2.setRaceName(name);
            this.dbStatBonusRaces.add(race2);
        }
    }

    public void setConversionOut(final String convertOut) {
        if (convertOut == null) {
            return;
        }
        if (convertOut.equals("Physical;Pierce;Elemental;Cold;Fire;Poison;Lightning;Life;Chaos;Aether;Stun")) {
            return;
        }
        this.convertOut = convertOut;
    }

    public void setConversionIn2(final String convertIn) {
        if (convertIn == null) {
            return;
        }
        if (convertIn.equals("Physical;Pierce;Elemental;Cold;Fire;Poison;Lightning;Life;Chaos;Aether;Stun")) {
            return;
        }
        this.convertIn2 = convertIn;
    }

    public void setConversionOut2(final String convertOut) {
        if (convertOut == null) {
            return;
        }
        if (convertOut.equals("Physical;Pierce;Elemental;Cold;Fire;Poison;Lightning;Life;Chaos;Aether;Stun")) {
            return;
        }
        this.convertOut2 = convertOut;
    }

    public void setItemSkillID(final String itemSkillID) {
        this.itemSkillID = itemSkillID;
    }

    public void setItemSkillLevelFormula(final String itemSkillLevelFormula) {
        this.itemSkillLevelFormula = itemSkillLevelFormula;
    }

    public void setItemSkillLevel(final int itemSkillLevel) {
        this.itemSkillLevel = itemSkillLevel;
    }

    public void setOffensiveChance(final int offensiveChance) {
        this.offensiveChance = offensiveChance;
    }

    public void setPetBonusID(final String petBonusID) {
        this.petBonusID = petBonusID;
    }

    public void setRarity(final String rarity) {
        if (rarity == null) {
            return;
        }
        if (rarity.equals("Common;Magical;Rare;Epic;Legendary;Broken;")) {
            return;
        }
        if (rarity.equals("Common;Magical;Rare;Epic;Legendary;Quest")) {
            return;
        }
        this.rarity = rarity;
    }

    public void setRequiredLevel(final int reqLevel) {
        this.reqLevel = reqLevel;
    }

    public void addRandomizerAffixIDEntry(final int index, final String affixID) {
        boolean found = false;
        for (final DBAffixSet.DBEntry entry : this.randomizers) {
            if (entry.getIndex() == index) {
                entry.setAffixID(affixID);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBAffixSet.DBEntry entry2 = new DBAffixSet.DBEntry();
            entry2.setIndex(index);
            entry2.setAffixID(affixID);
            this.randomizers.add(entry2);
        }
    }

    public void addRandomizerMaxLevelEntry(final int index, final int level) {
        boolean found = false;
        for (final DBAffixSet.DBEntry entry : this.randomizers) {
            if (entry.getIndex() == index) {
                entry.setMaxLevel(level);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBAffixSet.DBEntry entry2 = new DBAffixSet.DBEntry();
            entry2.setIndex(index);
            entry2.setMaxLevel(level);
            this.randomizers.add(entry2);
        }
    }

    public void addRandomizerMinLevelEntry(final int index, final int level) {
        boolean found = false;
        for (final DBAffixSet.DBEntry entry : this.randomizers) {
            if (entry.getIndex() == index) {
                entry.setMinLevel(level);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBAffixSet.DBEntry entry2 = new DBAffixSet.DBEntry();
            entry2.setIndex(index);
            entry2.setMinLevel(level);
            this.randomizers.add(entry2);
        }
    }

    public void addItemSetItemID(final String itemID) {
        this.itemSetItemIDs.add(itemID);
    }

    public void setRetaliationChance(final int retaliationChance) {
        this.retaliationChance = retaliationChance;
    }

    public void setItemSetSkillModifierLevel(final int value, final int index) {
        if (value == 1 && this.skillModifierLevel == 0) {
            this.skillModifierLevel = index;
        }
    }

    public void setRNGPercent(final int rngPercent) {
        this.rngPercent = rngPercent;
    }

    public void addTableItemID(final String itemID) {
        final DBLootTableItemAlloc alloc = new DBLootTableItemAlloc(this.fileName, itemID);
        this.tableItems.add(alloc);
    }

    public void addTableAffixSetID(final int index, final int type, final String affixSetID) {
        boolean found = false;
        for (final DBLootTableAffixSetAlloc affixSet : this.tableAffixSets) {
            if (affixSet.getIndex() == index && affixSet.getAffixType() == type) {
                affixSet.setAffixSetID(affixSetID);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBLootTableAffixSetAlloc affixSet2 = new DBLootTableAffixSetAlloc();
            affixSet2.setIndex(index);
            affixSet2.setAffixType(type);
            affixSet2.setAffixSetID(affixSetID);
            this.tableAffixSets.add(affixSet2);
        }
    }

    public void addTableMaxLevel(final int index, final int type, final int levelMax) {
        boolean found = false;
        for (final DBLootTableAffixSetAlloc affixSet : this.tableAffixSets) {
            if (affixSet.getIndex() == index && affixSet.getAffixType() == type) {
                affixSet.setMaxLevel(levelMax);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBLootTableAffixSetAlloc affixSet2 = new DBLootTableAffixSetAlloc();
            affixSet2.setIndex(index);
            affixSet2.setAffixType(type);
            affixSet2.setMaxLevel(levelMax);
            this.tableAffixSets.add(affixSet2);
        }
    }

    public void addTableMinLevel(final int index, final int type, final int levelMin) {
        boolean found = false;
        for (final DBLootTableAffixSetAlloc affixSet : this.tableAffixSets) {
            if (affixSet.getIndex() == index && affixSet.getAffixType() == type) {
                affixSet.setMinLevel(levelMin);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBLootTableAffixSetAlloc affixSet2 = new DBLootTableAffixSetAlloc();
            affixSet2.setIndex(index);
            affixSet2.setAffixType(type);
            affixSet2.setMinLevel(levelMin);
            this.tableAffixSets.add(affixSet2);
        }
    }

    public void setSkillControllerID(final String skillControllerID) {
        this.skillControllerID = skillControllerID;
    }

    public void setItemSetDescriptionTag(final String itemSetDescTag) {
        this.itemSetDescTag = itemSetDescTag;
    }

    public void setItemSetNameTag(final String itemSetNameTag) {
        this.itemSetNameTag = itemSetNameTag;
    }

    public void setTableNormalPrefixSuffix(final boolean nPre_nSuf) {
        this.nPre_nSuf = nPre_nSuf;
    }

    public void addTableSetTableID(final String tableID) {
        boolean found = false;
        for (final DBLootTableSetAlloc entry : this.tableSetAllocs) {
            if (entry.getTableID() == null) {
                entry.setTableID(tableID);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBLootTableSetAlloc entry2 = new DBLootTableSetAlloc();
            entry2.setTableID(tableID);
            this.tableSetAllocs.add(entry2);
        }
    }

    public void addTableSetMinLevel(final int levelMin) {
        boolean found = false;
        for (final DBLootTableSetAlloc entry : this.tableSetAllocs) {
            if (entry.getMinLevel() == -1) {
                entry.setMinLevel(levelMin);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBLootTableSetAlloc entry2 = new DBLootTableSetAlloc();
            entry2.setMinLevel(levelMin);
            this.tableSetAllocs.add(entry2);
        }
    }

    public void addFormulaSetFormula(final String formulaID, final String formula) {
        if (formula == null) {
            return;
        }
        if (formula.isEmpty()) {
            return;
        }
        final DBFormula dbf = new DBFormula();
        dbf.setFormulaID(formulaID);
        dbf.setFormula(formula);
        this.formulaSetFormulas.add(dbf);
    }

    public void setTableNormalPrefixRareSuffix(final boolean nPre_rSuf) {
        this.nPre_rSuf = nPre_rSuf;
    }

    public void setTableRarePrefixNormalSuffix(final boolean rPre_nSuf) {
        this.rPre_nSuf = rPre_nSuf;
    }

    public void setTableRarePrefixSuffix(final boolean rPre_rSuf) {
        this.rPre_rSuf = rPre_rSuf;
    }

    public void setArmorClass(final String armorClass) {
        if (armorClass == null) {
            return;
        }
        if (armorClass.equals("Caster;Light;Heavy;")) {
            return;
        }
        this.armorClass = armorClass;
    }

    public void addBaseTextureID(final String baseTextureID) {
        if (this.baseTextureID == null) {
            this.baseTextureID = baseTextureID;
        } else {
            this.baseTextureID = this.baseTextureID + ";" + baseTextureID;
        }
    }

    public void setArtifactClass(final String artifactClass) {
        if (artifactClass == null) {
            return;
        }
        if (artifactClass.equals("Lesser;Greater;Divine;")) {
            return;
        }
        this.artifactClass = artifactClass;
    }

    public void addBumpTextureID(final String bumpTextureID) {
        if (this.bumpTextureID == null) {
            this.bumpTextureID = bumpTextureID;
        } else {
            this.bumpTextureID = this.bumpTextureID + ";" + bumpTextureID;
        }
    }

    public void setMeshID(final String meshID) {
        this.meshID = meshID;
    }

    public void addGlowTextureID(final String glowTextureID) {
        if (this.glowTextureID == null) {
            this.glowTextureID = glowTextureID;
        } else {
            this.glowTextureID = this.glowTextureID + ";" + glowTextureID;
        }
    }

    public void setBaseTextureID(final String baseTextureID) {
        this.baseTextureID = baseTextureID;
    }

    public void setBumpTextureID(final String bumpTextureID) {
        this.bumpTextureID = bumpTextureID;
    }

    public void setGlowTextureID(final String glowTextureID) {
        this.glowTextureID = glowTextureID;
    }

    public void setItemDescriptionTag(final String itemDescriptionTag) {
        this.itemDescriptionTag = itemDescriptionTag;
        this.itemDescription = GDStashFrame.arcList.getTag(ARCDecompress.FileModule.All, GDConstants.TAG_TEXT_ITEMS, itemDescriptionTag, true);
        if (this.itemDescription == null) {
            this.itemDescription = GDStashFrame.arcList.getTag(ARCDecompress.FileModule.All, GDConstants.TAG_TEXT_STORY, itemDescriptionTag, true);
        }
    }

    private String insertLineBreaks(String s) {
        String newS = "";
        int len = 0;
        for (int posBlank = s.indexOf(" "); posBlank != -1; posBlank = s.indexOf(" ")) {
            final int posBreak = s.indexOf("<br>");
            if (posBreak != -1 && posBreak < posBlank) {
                final String word = s.substring(0, posBreak + 4);
                s = s.substring(posBreak + 4);
                newS += word;
                len = 0;
            } else {
                final String word = s.substring(0, posBlank);
                s = s.substring(posBlank + 1);
                newS += word;
                len += word.length();
                if (len < 80) {
                    newS += " ";
                } else {
                    newS += "<br>";
                    len = 0;
                }
            }
        }
        newS += s;
        return newS;
    }

    public void setShaderID(final String shaderID) {
        this.shaderID = shaderID;
    }

    public void setBitmapID(final String bitmapID) {
        this.bitmapID = bitmapID;
    }

    public void setShardBitmapID(final String shardBitmapID) {
        this.shardBitmapID = shardBitmapID;
    }

    public void setItemNameTag(final String itemNameTag) {
        this.itemNameTag = itemNameTag;
        String s = GDStashFrame.arcList.getTag(ARCDecompress.FileModule.All, GDConstants.TAG_TEXT_ITEMS, itemNameTag, false);
        if (s == null) {
            s = GDStashFrame.arcList.getTag(ARCDecompress.FileModule.All, GDConstants.TAG_TEXT_STORY, itemNameTag, false);
        }
        this.genderCode = -1;
        if (s != null && s.startsWith("[")) {
            final String code = s.substring(0, 4);
            s = s.substring(4);
            this.genderCode = ARZDecompress.getGenderCode(code);
        }
        if (this.genderCode == -1) {
            this.genderCode = 0;
        }
        this.itemName = s;
    }

    public void setQualityTag(final String qualityTag) {
        this.qualityTag = qualityTag;
    }

    public void setStyleTag(final String styleTag) {
        this.styleTag = styleTag;
    }

    public void setItemSetID(final String itemSetID) {
        this.itemSetID = itemSetID;
    }

    public void setArtifactID(final String artifactID) {
        this.artifactID = artifactID;
    }

    public void setBonusAffixSetID(final String bonusAffixSetID) {
        this.bonusAffixSetID = bonusAffixSetID;
    }

    public void setCostFormulaSetID(final String costFormulaSetID) {
        this.costFormulaSetID = costFormulaSetID;
    }

    public void setSoulbound(final boolean soulbound) {
        this.soulbound = soulbound;
    }

    public void setHidePrefix(final boolean hidePrefix) {
        this.hidePrefix = hidePrefix;
    }

    public void setHideSuffix(final boolean hideSuffix) {
        this.hideSuffix = hideSuffix;
    }

    public void setQuestItem(final boolean questItem) {
        this.questItem = questItem;
    }

    public void setCannotPickup(final boolean cannotPickup) {
        this.cannotPickup = cannotPickup;
    }

    public void setItemLevel(final int itemLevel) {
        this.itemLevel = itemLevel;
    }

    public void setSlotAxe1H(final boolean slotAxe1H) {
        this.slots.slotAxe1H = slotAxe1H;
    }

    public void setSlotAxe2H(final boolean slotAxe2H) {
        this.slots.slotAxe2H = slotAxe2H;
    }

    public void setSlotDagger1H(final boolean slotDagger1H) {
        this.slots.slotDagger1H = slotDagger1H;
    }

    public void setSlotMace1H(final boolean slotMace1H) {
        this.slots.slotMace1H = slotMace1H;
    }

    public void setSlotMace2H(final boolean slotMace2H) {
        this.slots.slotMace2H = slotMace2H;
    }

    public void setSlotScepter1H(final boolean slotScepter1H) {
        this.slots.slotScepter1H = slotScepter1H;
    }

    public void setPlusAllSkills(final int plusAllSkills) {
        this.plusAllSkills = plusAllSkills;
    }

    public void setComponentPieces(final int componentPieces) {
        this.componentPieces = componentPieces;
    }

    public void setSlotStaff2H(final boolean slotStaff2H) {
        this.slots.slotStaff2H = slotStaff2H;
    }

    public void setSlotSword1H(final boolean slotSword1H) {
        this.slots.slotSword1H = slotSword1H;
    }

    public void setSlotSword2H(final boolean slotSword2H) {
        this.slots.slotSword2H = slotSword2H;
    }

    public void setSlotRanged1H(final boolean slotRanged1H) {
        this.slots.slotRanged1H = slotRanged1H;
    }

    public void setSlotRanged2H(final boolean slotRanged2H) {
        this.slots.slotRanged2H = slotRanged2H;
    }

    public void setSlotShield(final boolean slotShield) {
        this.slots.slotShield = slotShield;
    }

    public void setSlotOffhand(final boolean slotOffhand) {
        this.slots.slotOffhand = slotOffhand;
    }

    public void setSlotAmulet(final boolean slotAmulet) {
        this.slots.slotAmulet = slotAmulet;
    }

    public void setSlotBelt(final boolean slotBelt) {
        this.slots.slotBelt = slotBelt;
    }

    public void setSlotMedal(final boolean slotMedal) {
        this.slots.slotMedal = slotMedal;
    }

    public void setSlotRing(final boolean slotRing) {
        this.slots.slotRing = slotRing;
    }

    public void setSlotHead(final boolean slotHead) {
        this.slots.slotHead = slotHead;
    }

    public void setSlotShoulders(final boolean slotShoulders) {
        this.slots.slotShoulders = slotShoulders;
    }

    public void setSlotChest(final boolean slotChest) {
        this.slots.slotChest = slotChest;
    }

    public void setSlotHands(final boolean slotHands) {
        this.slots.slotHands = slotHands;
    }

    public void setSlotLegs(final boolean slotLegs) {
        this.slots.slotLegs = slotLegs;
    }

    public void setSlotFeet(final boolean slotFeet) {
        this.slots.slotFeet = slotFeet;
    }

    public DBStat getCreateDBStat(final String search, final int index) {
        DBStat dbStat = null;
        DBStat first = null;
        boolean found = false;
        final int level = index + 1;
        for (final DBStat dbs : this.dbStats) {
            if (dbs == null) {
                continue;
            }
            if (!dbs.getStatType().equals(search)) {
                continue;
            }
            if (first == null) {
                first = dbs;
            }
            if (dbs.getSkillLevel() == level) {
                dbStat = dbs;
                found = true;
                break;
            }
        }
        if (!found) {
            if (first == null) {
                dbStat = new DBStat();
            } else {
                dbStat = first.clone();
            }
            dbStat.setStatType(search);
            dbStat.setSkillLevel(level);
            this.dbStats.add(dbStat);
        }
        return dbStat;
    }

    public void processItemSkillLevelFormula() {
        if (this.itemSkillLevelFormula == null) {
            return;
        }
        try {
            ExpressionBuilder builder = new ExpressionBuilder(this.itemSkillLevelFormula);
            builder = builder.variables(new String[]{"itemLevel"});
            final Expression expression = builder.build();
            expression.setVariable("itemLevel", (double) this.getRequiredLevel());
            final int value = (int) expression.evaluate();
            this.itemSkillLevel = value;
        } catch (Exception ex) {
        }
    }

    public void setPetNameTag(final String petNameTag) {
        this.skillNameTag = petNameTag;
        if (petNameTag != null) {
            this.petName = GDStashFrame.arcList.getTag(ARCDecompress.FileModule.All, GDConstants.TAG_TEXT_PETS, petNameTag, false);
        }
    }

    public void setMaxStackSize(final int maxStackSize) {
        this.maxStackSize = maxStackSize;
    }

    public void setSlotSpear1H(final boolean slotSpear1H) {
        this.slots.slotSpear1H = slotSpear1H;
    }

    public void setSlotSpear2H(final boolean slotSpear2H) {
        this.slots.slotSpear2H = slotSpear2H;
    }

    public void addPetSkillsSkillID(final int index, final String skillID) {
        boolean found = false;
        for (final DBPetSkill psk : this.petSkills) {
            if (psk.getIndex() == index) {
                psk.setSkillID(skillID);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBPetSkill psk2 = new DBPetSkill();
            psk2.setIndex(index);
            psk2.setSkillID(skillID);
            this.petSkills.add(psk2);
        }
    }

    public void addPetSkillsFormulaLevel(final int index, final String formulaLevel) {
        boolean found = false;
        for (final DBPetSkill psk : this.petSkills) {
            if (psk.getIndex() == index) {
                psk.setFormulaLevel(formulaLevel);
                found = true;
                break;
            }
        }
        if (!found) {
            final DBPetSkill psk2 = new DBPetSkill();
            psk2.setIndex(index);
            psk2.setFormulaLevel(formulaLevel);
            this.petSkills.add(psk2);
        }
    }

    public void setPetFormulaLevel(final String petFormulaLevel) {
        this.petFormulaLevel = petFormulaLevel;
    }

    public void setPetBioID(final String petBioID) {
        this.petBioID = petBioID;
    }

    public void setPetDieSkillID(final String petDieSkillID) {
        this.petDieSkillID = petDieSkillID;
    }

    public void setBioFormulaLife(final String bioFormulaLife) {
        this.bioFormulaLife = bioFormulaLife;
    }

    public void setBioFormulaMana(final String bioFormulaMana) {
        this.bioFormulaMana = bioFormulaMana;
    }

    public boolean isGameEngine() {
        return this.fileName.equals("records/game/gameengine.dbr") || this.fileName.equals("records/game/gamefactions.dbr");
    }

    public boolean isFaction() {
        return this.template == null || this.template.equals("database/templates/factionpack.tpl");
    }

    public boolean isMerchant() {
        return this.template == null || this.template.equals("database/templates/npcmerchant.tpl");
    }

    public boolean isMerchantTableSet() {
        return this.template == null || this.template.equals("database/templates/npcmerchant.tpl") || this.template.equals("database/templates/factionmarket.tpl") || this.template.equals("database/templates/factiontier.tpl");
    }

    public boolean isMerchantTable() {
        return this.template == null || this.template.equals("database/templates/factiontier.tpl");
    }

    public boolean isPlayerEngine() {
        return this.fileName.equals("records/creatures/pc/playerlevels.dbr") || this.fileName.equals("records/creatures/pc/malepc01.dbr");
    }

    public boolean isConstellation() {
        return this.template == null || this.template.equals("database/templates/ingameui/devotionconstellation.tpl");
    }

    public boolean isSkillButton() {
        return this.template == null || this.template.equals("database/templates/ingameui/skillbutton.tpl");
    }

    public boolean isBitmap() {
        return this.template == null || this.template.equals("database/templates/ingameui/bitmapsingle.tpl") || this.template.equals("database/templates/ingameui/bargraph.tpl");
    }

    public boolean isInventoryGrid() {
        return this.template == null || this.template.equals("database/templates/ingameui/inventorygrid.tpl");
    }

    public boolean isCaravanWindow() {
        return this.template == null || this.template.equals("database/templates/ingameui/caravanwindowprivate.tpl") || this.template.equals("database/templates/ingameui/caravanwindowpublic.tpl");
    }

    public boolean isClassTable() {
        return this.template == null || this.template.equals("database/templates/ingameui/skillpanectrl.tpl");
    }

    public boolean isSkillMaster() {
        return this.template == null || this.template.equals("database/templates/ingameui/skillswindow.tpl");
    }

    public boolean isShrine() {
        return this.template == null || this.template.equals("database/templates/staticshrine.tpl");
    }

    public boolean isSkillTree() {
        return this.template == null || this.template.equals("database/templates/skilltree.tpl") || this.template.equals("database/templates/skilltree_expanded.tpl") || this.template.equals("database/templates/skilltree_100.tpl");
    }

    public boolean isSkill() {
        return this.template == null || (!this.template.equals("database/templates/skilltree.tpl") && !this.template.equals("database/templates/skilltree_expanded.tpl") && !this.template.equals("database/templates/skilltree_100.tpl") && !this.template.equals("database/templates/skillautocastcontroller.tpl") && (this.template.startsWith("database/templates/skill") || (this.template.equals("database/templates/petbonus.tpl") && !this.fileName.startsWith("records/items/lootaffixes/")) || this.template.equals("database/templates/fixeditemskill_buff.tpl")));
    }

    public boolean isPet() {
        return this.template == null || this.template.equals("database/templates/pet.tpl") || this.template.equals("database/templates/petplayerscaling.tpl");
    }

    public boolean isPetBio() {
        return this.template == null || this.template.equals("database/templates/characterattributeequations.tpl");
    }

    public boolean isController() {
        return this.template == null || this.template.equals("database/templates/skillautocastcontroller.tpl");
    }

    public boolean isAffix() {
        return this.template == null || this.template.equals("database/templates/lootrandomizer.tpl") || (this.template.equals("database/templates/petbonus.tpl") && this.fileName.startsWith("records/items/lootaffixes/"));
    }

    public boolean isAffixSet() {
        return this.template == null || this.template.equals("database/templates/lootrandomizertabledynamic.tpl");
    }

    public boolean isFormulaSet() {
        return this.template == null || this.template.equals("database/templates/itemcost.tpl");
    }

    public boolean isItemSet() {
        return this.template == null || this.template.equals("database/templates/itemset.tpl");
    }

    public boolean isLootTable() {
        return this.template == null || this.template.equals("database/templates/lootitemtable_dynweighted_dynaffix.tpl");
    }

    public boolean isLootTableSet() {
        return this.template == null || this.template.equals("database/templates/leveltable.tpl");
    }
}
